﻿using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;

public class d : IDisposable
{
    public const int a = 0x400;
    private uint b;
    private bool c;
    private m d;
    private Action<bool> e;
    private Action<c> f;
    private Action<bool> g;
    private Action h;
    [CompilerGenerated]
    private string i;
    [CompilerGenerated]
    private IntPtr j;
    [CompilerGenerated]
    private j k;
    [CompilerGenerated]
    private bool l;

    private d()
    {
    }

    public d(j A_0)
    {
        this.a(A_0);
        this.a();
    }

    private void a()
    {
        k k;
        this.a("WPFTaskbarIcon_" + DateTime.Now.Ticks);
        this.d = new m(this.a);
        k.a = 0;
        k.b = this.d;
        k.c = 0;
        k.d = 0;
        k.e = IntPtr.Zero;
        k.f = IntPtr.Zero;
        k.g = IntPtr.Zero;
        k.h = IntPtr.Zero;
        k.i = "";
        k.j = this.c();
        o.RegisterClass(ref k);
        this.b = o.RegisterWindowMessage("TaskbarCreated");
        this.a(o.CreateWindowEx(0, this.c(), "", 0, 0, 0, 1, 1, 0, 0, 0, 0));
        if (this.f() == IntPtr.Zero)
        {
            throw new Win32Exception();
        }
    }

    [CompilerGenerated]
    public void a(j A_0)
    {
        this.k = A_0;
    }

    public void a(Action A_0)
    {
        Action action2;
        Action h = this.h;
        do
        {
            action2 = h;
            Action action3 = (Action) Delegate.Combine(action2, A_0);
            h = Interlocked.CompareExchange<Action>(ref this.h, action3, action2);
        }
        while (h != action2);
    }

    public void a(Action<c> A_0)
    {
        Action<c> action2;
        Action<c> f = this.f;
        do
        {
            action2 = f;
            Action<c> action3 = (Action<c>) Delegate.Remove(action2, A_0);
            f = Interlocked.CompareExchange<Action<c>>(ref this.f, action3, action2);
        }
        while (f != action2);
    }

    public void a(Action<bool> A_0)
    {
        Action<bool> action2;
        Action<bool> e = this.e;
        do
        {
            action2 = e;
            Action<bool> action3 = (Action<bool>) Delegate.Remove(action2, A_0);
            e = Interlocked.CompareExchange<Action<bool>>(ref this.e, action3, action2);
        }
        while (e != action2);
    }

    private void a(bool A_0)
    {
        if (!this.d() && A_0)
        {
            this.b(true);
            o.DestroyWindow(this.f());
            this.d = null;
        }
    }

    [CompilerGenerated]
    private void a(IntPtr A_0)
    {
        this.j = A_0;
    }

    [CompilerGenerated]
    private void a(string A_0)
    {
        this.i = A_0;
    }

    private void a(uint A_0, uint A_1, uint A_2)
    {
        if (A_0 == 0x400)
        {
            switch (A_2)
            {
                case 0x200:
                    this.f(c.a);
                    return;

                case 0x201:
                    this.f(c.c);
                    return;

                case 0x202:
                    if (!this.c)
                    {
                        this.f(c.e);
                    }
                    this.c = false;
                    return;

                case 0x203:
                    this.c = true;
                    this.f(c.h);
                    return;

                case 0x204:
                    this.f(c.b);
                    return;

                case 0x205:
                    this.f(c.d);
                    return;

                case 0x206:
                case 0x209:
                    return;

                case 0x207:
                    this.f(c.f);
                    return;

                case 520:
                    this.f(c.g);
                    return;

                case 0x402:
                    this.g(true);
                    return;

                case 0x403:
                case 0x404:
                    this.g(false);
                    return;

                case 0x405:
                    this.f(c.i);
                    return;

                case 0x406:
                    this.e(true);
                    return;

                case 0x407:
                    this.e(false);
                    return;
            }
        }
    }

    private long a(IntPtr A_0, uint A_1, uint A_2, uint A_3)
    {
        if (A_1 == this.b)
        {
            this.h();
        }
        this.a(A_1, A_2, A_3);
        return o.DefWindowProc(A_0, A_1, A_2, A_3);
    }

    internal static d b()
    {
        d d = new d();
        d.a(IntPtr.Zero);
        d.a(j.c);
        return d;
    }

    public void b(Action A_0)
    {
        Action action2;
        Action h = this.h;
        do
        {
            action2 = h;
            Action action3 = (Action) Delegate.Remove(action2, A_0);
            h = Interlocked.CompareExchange<Action>(ref this.h, action3, action2);
        }
        while (h != action2);
    }

    public void b(Action<c> A_0)
    {
        Action<c> action2;
        Action<c> f = this.f;
        do
        {
            action2 = f;
            Action<c> action3 = (Action<c>) Delegate.Combine(action2, A_0);
            f = Interlocked.CompareExchange<Action<c>>(ref this.f, action3, action2);
        }
        while (f != action2);
    }

    public void b(Action<bool> A_0)
    {
        Action<bool> action2;
        Action<bool> g = this.g;
        do
        {
            action2 = g;
            Action<bool> action3 = (Action<bool>) Delegate.Remove(action2, A_0);
            g = Interlocked.CompareExchange<Action<bool>>(ref this.g, action3, action2);
        }
        while (g != action2);
    }

    [CompilerGenerated]
    private void b(bool A_0)
    {
        this.l = A_0;
    }

    [CompilerGenerated]
    internal string c()
    {
        return this.i;
    }

    public void c(Action<bool> A_0)
    {
        Action<bool> action2;
        Action<bool> e = this.e;
        do
        {
            action2 = e;
            Action<bool> action3 = (Action<bool>) Delegate.Combine(action2, A_0);
            e = Interlocked.CompareExchange<Action<bool>>(ref this.e, action3, action2);
        }
        while (e != action2);
    }

    [CompilerGenerated]
    public bool d()
    {
        return this.l;
    }

    public void d(Action<bool> A_0)
    {
        Action<bool> action2;
        Action<bool> g = this.g;
        do
        {
            action2 = g;
            Action<bool> action3 = (Action<bool>) Delegate.Combine(action2, A_0);
            g = Interlocked.CompareExchange<Action<bool>>(ref this.g, action3, action2);
        }
        while (g != action2);
    }

    public void Dispose()
    {
        this.a(true);
        GC.SuppressFinalize(this);
    }

    [CompilerGenerated]
    public j e()
    {
        return this.k;
    }

    [CompilerGenerated]
    internal IntPtr f()
    {
        return this.j;
    }

    ~d()
    {
        this.a(false);
    }
}

